﻿using Furion;
using Furion.DatabaseAccessor;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TulingMember.Core;

namespace TulingMember.Application.Helper
{
    public static class DisPlayNameHelper
    {
        public static string GetDisplayName(string customerName)
        {
            var usertype = (UserType)int.Parse(App.User.FindFirst(ClaimConst.USER_TYPE).Value);
            if (usertype == UserType.System)
            {
                return customerName;
            }
            else
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < customerName.Length - 1; i++)
                {
                    sb.Append("*");
                }
                sb.Append(customerName.Substring(customerName.Length - 1, 1));
                return sb.ToString();
            }
        }
    }
}
